/**
*This software is under LGPL license,
*see http://www.gnu.org/licenses/lgpl-3.0.txt (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>)
*Console.h First issued by chuanshenglu@gmail.com 2008.10
*/
#include"trstd.h"
#include"Console.h"

namespace TR{
	//Cons and des
	Console::Console()
	{
		mKeyboardListeners.clear();
		mFocusListeners.clear();
	}
	Console::Console(Console&){
	}
	Console::~Console(){
	}

	Coord	Console::GetCursorPos(){
		return mCursorPos;
	}

	//Functions to manager listener lists;
	void Console::AddKeyboardEventListener(TR::IKeyboardEventListener *listener){
		mKeyboardListeners.push_back(listener);
	}
	BOOL Console::RemoveKeyboardEventListener(TR::IKeyboardEventListener *listener){
		mKeyboardListeners.remove(listener);
		return TRUE;
	}
	void Console::AddFocusEventListener(TR::IFocusEventListener *listener){
		mFocusListeners.push_back(listener);
	}
	BOOL Console::RemoveFocusEventListener(TR::IFocusEventListener *listener){
		mFocusListeners.remove(listener);
		return TRUE;
	}

	//Console gets and sets
	BOOL Console::SetTitle(const String& str){
		mTitle=str;
		return true;
	}
	BOOL Console::SetTitle(const TCHAR* str){
		mTitle=str;
		return true;
	}
	String& Console::GetTitle(){
		return mTitle;
	}
	uint32 Console::GetWidth(){
		return mSize.X;
	}
	uint32 Console::GetHeight(){
		return mSize.Y;
	}
	Console::InputMode Console::GetInputMode(){
		return mInputMode;
	}	
}